package com.monkeyboy.second.threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Description
 * @Author Gavin
 * @date 2020.04.27 17:12
 */
public class SingleThreadExecutor {
    public static void main(String[] args) {
        //该线程池只有一个线程，任务一个一个被执行
        ExecutorService executorService= Executors.newSingleThreadExecutor();
        for (int i = 0; i <1000 ; i++) {
            executorService.execute(new Task());
        }
    }
}
